package com.bwf.pojo;

import com.bwf.exception.DepositException;

import java.io.Serializable;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/12 9:22
 * @Copyright 博为峰
 */
public class SavingAccount extends Account{

    public SavingAccount() {
        super();
    }

    public SavingAccount(String cardNo, String password, double balance) {
        super(cardNo, password, balance);
    }

    public void deposit(double money) {
        if (money > this.getBalance()) {
            throw new DepositException("余额不足！！！");
        }
        double balance = this.getBalance();
        balance -= money;
        this.setBalance(balance);
    }

}